{% extends "enterprise/base.html" %}

{% block css %}
{% endblock %}

{% block content %}
            <script type="text/javascript">
                var primary_menu = "menu_0";
                var sub_menu = "menu_0_3";
            </script>
            <form method="post" enctype="application/x-www-form-urlencoded" class="formSubmit" >
            <div class="col-md-12">
                <!-- <div class="panel panel-primary">
                    <div class="panel-heading">
                        <div class="panel-title"><h3>法律法规遵守情况</h3></div>
                    </div>
                </div> -->
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        <div class="panel-title"><h3>四、应急预案及突发环境事件</h3></div>
                        <div class="panel-options">
                            <a href="#" data-rel="collapse"><i class="entypo-down-open"></i></a>
                            <!--<a href="#" data-rel="reload"><i class="entypo-arrows-ccw"></i></a>-->
                        </div>
                    </div>
                    <div class="panel-body with-table">
                            <table class="input_in table-detail">
                                <tr>
                                    <th width="25%">是否编制应急预案</th>
                                    {%if basic.file_ids%}
                                    <td width="25%"><input checked="checked"  type="radio" value="1" name="file_ids">是&nbsp;&nbsp;&nbsp;&nbsp; <input  value="0" type="radio" name="file_ids">否</td>
                                    {%else%}
                                    <td width="25%"><input type="radio" value="1" name="file_ids">是&nbsp;&nbsp;&nbsp;&nbsp; <input checked="checked" value="0" type="radio" name="file_ids">否</td>
                                    {% endif %}
                                    <th width="25%">编制时间</th>
                                    <td width="25%"><input type="text" datatype="*" name="preparation_time" value="{{basic.preparation_time}}"  placeholder="请输入"></td>
                                </tr>
                                <tr>
                                    <th>应急预案是否备案</th>
                                    {%if basic.is_record%}
                                    <td><input checked="checked"  type="radio" value="1"  name="is_record">是&nbsp;&nbsp;&nbsp;&nbsp; <input value="0"  type="radio" name="is_record">否</td>
                                    {%else%}
                                    <td><input type="radio" value="1"  name="is_record">是&nbsp;&nbsp;&nbsp;&nbsp; <input value="0"  checked="checked"  type="radio" name="is_record">否</td>
                                    {% endif %}
                                    <th>备案时间及单位</th>
                                    <td><input type="text" datatype="*" name="filing_time" value="{{basic.filing_time}}"   placeholder="请输入"></td>
                                </tr>
                                <tr>
                                    <th>近10年发生突发环境事件情况</th>
                                    <td colspan="3">
                                    	{%if basic.drill%}
                                    	<input type="radio" checked="checked"  value="1"  name="drill">有&nbsp;&nbsp;&nbsp;&nbsp; <input value="0"  type="radio" name="drill">无
                                    	{%else%}
                                    	<input type="radio" value="1"  name="drill">有&nbsp;&nbsp;&nbsp;&nbsp; <input value="0"  type="radio" checked="checked"  name="drill">无
                                    	 {% endif %}
                                        &nbsp;&nbsp;&nbsp;&nbsp;共 <input name="drill_times" value="{{basic.drill_times}}" type="text" style="width:30px;"> 次</td>
                                </tr>
                                <tr>
                                    <th>事件描述</th>
                                    <td colspan="3">
                                        <textarea name="remark"     placeholder="请输入" style="resize:no;">{{basic.remark}}</textarea></td>
                                </tr>
                            </table>
                        
                    </div>
                </div>
                <div class="buttons">
                    <input onclick="submitSave()" type="submit" class="btn btn-orange btn-lg" value="暂存">
                                <input type="submit" class="btn btn-success btn-lg" value="确认">
			        <!-- <input class="btn btn-info btn-lg" type="reset" value="重置"/> -->
                </div>
            </div>
            </form>

{% endblock %}
{% block js %}
<script type="text/javascript">
    $(function(){
        $("tr input:radio:checked").each(function(){
            var flag = $(this).val();
            if (flag==1) {
                $(this).closest("tr").find("input:text").attr({"disabled":false,"datatype":"*"});
                if ($(this).attr("name")=="drill") {
                    $("textarea").attr({"disabled":false,"datatype":"*"});
                }
            }else{
                $(this).closest("tr").find("input:text").val("").attr({"disabled":true,"datatype":""});
                if ($(this).attr("name")=="drill") {
                    $("textarea").val("").attr({"disabled":true,"datatype":""});
                }
            }
        })
        
        $("tr input:radio").click(function(){
            var flag = $(this).val();
            console.log(flag)
            if (flag==1) {
                console.log("有")
                $(this).closest("tr").find("input:text").attr({"disabled":false,"datatype":"*"});
                if ($(this).attr("name")=="drill") {
                    $("textarea").attr({"disabled":false,"datatype":"*"});
                }
            }else{
                console.log("无")
                $(this).closest("tr").find("input:text").val("").attr({"disabled":true,"datatype":""});
                if ($(this).attr("name")=="drill") {
                    $("textarea").val("").attr({"disabled":true,"datatype":""});
                }
            }
        })
    });
</script>
{% endblock %}